/*
 * Copyright (c) 2022 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, Hardware
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef FOUNDATION_GRAPHIC_3D_STANDARD_RENDER_SERVICE_INTF_ENGINE_H_
#define FOUNDATION_GRAPHIC_3D_STANDARD_RENDER_SERVICE_INTF_ENGINE_H_

#include <cstdint>
#include <string>
#include <EGL/egl.h>
#include <EGL/eglext.h>
#include <GLES3/gl31.h>
#include <GLES2/gl2ext.h>

namespace OHOS {
namespace Render3D {
struct IPlatformCreateInfo {};

struct TextureInfo {
    int32_t width_ = 0.0f;
    int32_t height_ = 0.0f;
    GLint textureId_ = -1;
};

class IEngine {
public:
    enum class BackgroundType {
        NONE,
        CUBEMAP,
    };

    enum class LightType {
        NONE,
        POINT,
        AREA,
        PARALLEL,
        CONE,
    };

    enum class AnimationState {
        STOP,
        PAUSE,
        PLAY,
    };

    struct LightInfo {
        LightType type_ = LightType::NONE;
        bool shadow_ = false;
        float color_[3] = { 0.0f };
        float position_[3] = { 0.0f };
        float quat_[4] = { 0.0f };
    };

    struct CameraInfo {
        float zNear_ = 0.0f;
        float zFar_ = 0.0f;
        float fowDegrees_ = 0.0f;
        float position_[3] = { 0.0f };
        float quat_[4] = { 0.0f };
    };

    IEngine() = default;
    virtual ~IEngine() = default;
    virtual TextureInfo CreateTargetSceneTexture(uint32_t key, int32_t width, int32_t height) = 0;
    virtual void SetTargetSceneTexture(uint32_t key, const TextureInfo& info) = 0;
    virtual void ImportScene(uint32_t key, const std::string& gltfPath) = 0;
    virtual void ImportBackgroundScene(uint32_t key, const std::string& gltfPath) = 0;
    virtual void SetUpCamera(uint32_t key, const std::string& cameraName, const CameraInfo& info) = 0;
    virtual void SetUpLight(uint32_t key, const std::string& lightName, const LightInfo& info) = 0;
    virtual void SetUpAnimation(uint32_t key, const std::string& animationName) = 0;
    virtual void SetAnimationState(uint32_t key, const std::string& animationName, AnimationState state) = 0;
    virtual void RenderFrame(uint32_t key) = 0;
};
} // namespace Render3D
} // namespace OHOS
#endif